Transform encoding is a component of a video encoding and decoding technology. The transform encoding refers to performing a certain functional transformation on a signal to transform the signal in one signal space to a signal in another signal space, and then quantizing and encoding the transformed signal. Data compression in a transform encoding system has three steps: transforming, quantizing, and entropy encoding. Generally, a transformation process is reversible, that is, an inverse transformation exists, so as to restore original data. An encoding end obtains residual data of a video image by using predictive encoding, quantizes the residual data, and encodes the quantized residual data in a code stream by entropy encoding, thereby completing an encoding process. A decoding end parses the code stream to obtain data, reconstructs the residual data by inverse quantizing and inverse transformation, and reconstructs a decoded image with reference to a predicted value obtained from the predictive encoding, thereby completing a decoding process.
In a current transform encoding technology, different transformation types exist according to different transformation matrices, where one classification manner is classification, according to a shape of a transformation matrix, into three transformation modes including a square block transformation, a latitudinal rectangular block transformation, and a longitudinal rectangular block transformation, so as to process three residual data block types including a square block, a latitudinal rectangular block, and a longitudinal rectangular block respectively, as shown in FIG. 1.
Currently, at a video encoding end, when a transformation mode is selected, an optimal transformation mode is selected from the foregoing three transformation modes according to a rate distortion optimization rule; and residual data is transformed by using the selected transformation mode, and selection information of the transformation mode is encoded in a code stream and transferred to a decoding end.
At the video encoding end, a mode needs to be selected among three scanning modes, and therefore, complexity at the encoding end is high. In addition, the selection information of the transformation mode needs to be encoded into the code stream, thereby affecting compression and encoding efficiency.